<%@ page contentType="text/html;charset=UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head>
    <meta charset=UTF-8>
    <title>出校申请总览</title>
    <script type="text/javascript">
        function del(applyID) {
            if (window.confirm("好哥们，确定要删除吗？（删除了之后可是不可恢复的哦）")) {
                document.location.href = "delete?applyID=" + applyID;
            }
        }
    </script>
</head>

<body>

<h1>${sessionScope.UserMessage.userId} 普通用户出校申请管理</h1>
<h2>(当前在线人数：${applicationScope.OnlinePeople})</h2>
<h1>按照格式来填写哦</h1>
<br>
<a href="${pageContext.request.contextPath}/logout">[安全退出]</a>


<table align="center" border="1" width="70%">

    <c:if test="${requestScope.MessageList == '[]'}">
        <h2 align="center">
            你现在还未提交任何申请, 提交过后请刷新界面。
        </h2>
    </c:if>

    <c:if test="${requestScope.MessageList != '[]'}">
        <tr>
            <th>审批提交序号</th>
            <th>提交时间</th>
            <th>申请时长（小时）</th>
            <th>审批状态（P,R,A）</th>
            <th>执行操作</th>
        </tr>
    </c:if>

    <c:forEach items="${requestScope.MessageList}" var="message" varStatus="messageStatus">
        <tr align="center">
            <td align="center">${messageStatus.count}
            </td>
            <td align="center">${message.submitTime}
            </td>
            <td align="center">${message.wantTime}
            </td>
            <td align="center">${message.result}
            </td>
            <td align="center"><a href="javascript:void(0)" onclick="del('${message.applyId}')">删 除</a></td>
        </tr>
    </c:forEach>

</table>
<br>
<hr>
<br>

<form action="${pageContext.request.contextPath}/add">
    <table align="center">
        <tr>
            <td><label for="userid">你的账户ID：</label></td>
            <td><input type="text" name="userid" id="userid" value="${sessionScope.UserMessage.userId}" readonly/>
            </td>
        </tr>
        <tr>
            <td><label for="dateTime">预出校时间：</label></td>
            <td><input type="datetime-local" name="dateTime" id="dateTime"/></td>
        </tr>
        <tr>
            <td><label for="outTime">出校时长：</label></td>
            <td><input type="text" name="outTime" id="outTime"/></td>
        </tr>
        <tr>
            <td><input type="submit" value="提交申请"/></td>
        </tr>
    </table>
</form>

</body>
</html>